package com.person.leetcode.editor.cn;

/**
  * 338.比特位计数
  * 2022-10-08 17:04:00
**/
public class Sequence_0338_CountingBits {
    public static void main(String[] args) {
        Solution solution = new Sequence_0338_CountingBits().new Solution();
    }
    //leetcode submit region begin(Prohibit modification and deletion)
class Solution {
    public int[] countBits(int n) {
        int[] ans = new int[n + 1];
        for (int i = 0; i <= n; i++) {
            ans[i] = Integer.bitCount(i);
        }
        return ans;
    }
}
//leetcode submit region end(Prohibit modification and deletion)

}